#ifndef QUERYMICROMAN_H
#define QUERYMICROMAN_H

#include <QObject>
#include <QMutex>
#include <QTcpSocket>
#include <QTimer>

#include "t2cCommon.h"


class QueryMicroMan : public QObject
{
    Q_OBJECT

    quint64 maxtimeout;
    QTcpSocket * sock;
    QTimer * timer;
    QMutex mtx;

public:
    explicit QueryMicroMan( QObject *parent = 0 );

    volatile bool locked;
    /*volatile*/ QString outStr;
    void setTimeout( quint64 t ) { maxtimeout = t; }

signals:
    void sgnReady();
    void updated( QString retStr );
    
private slots:
    //void onConnected();
    void onReadyRead();
    void onTimeout();

public slots:
    void Connect( QString h, quint16 p );
    void Disconnect();
    void ExecCmd( const QString cmd );
};

#endif // QUERYMICROMAN_H
